package com.richper.springcloudh2020.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GetWayConfig {

    @Bean
    public RouteLocator consumerRoute(RouteLocatorBuilder routeLocatorBuilder){
        return routeLocatorBuilder.routes().
                route("route_1",r -> r.path("/guonei").uri("http://news.baidu.com/guonei")).
                route("route_2",r -> r.path("/lady").uri("http://news.baidu.com/lady")).
                route("route_3",r -> r.path("/mil").uri("http://news.baidu.com/mil")).
                route("route_4",r -> r.path("/guoji").uri("http://news.baidu.com/guoji")).
                route("route_5",r -> r.path("/finance").uri("http://news.baidu.com/finance")).
                route("route_6",r -> r.path("/ent").uri("http://news.baidu.com/ent")).
                route("route_7",r -> r.path("/sports").uri("http://news.baidu.com/sports")).
                route("route_8",r -> r.path("/internet").uri("http://news.baidu.com/internet")).
                route("route_9",r -> r.path("/tech").uri("http://news.baidu.com/tech")).
                route("route_10",r -> r.path("/game").uri("http://news.baidu.com/game")).
                route("route_11",r -> r.path("/auto").uri("http://news.baidu.com/auto")).
                route("route_12",r -> r.path("/house").uri("http://news.baidu.com/house")).
                route("route_12",r -> r.path("/").uri("http://news.baidu.com/"))
                .build();
    }
}